import { createApp } from 'vue'
import router from './router/index.js'
import App from './App.vue'

import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'

// ① 引入createPinia方法从pinia
import { createPinia } from 'pinia'

// 引入图标
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

// ② 拿到pinia实例
const pinia = createPinia()
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
// 2 pinia使用数据持久化插件
pinia.use(piniaPluginPersistedstate)

const app = createApp(App)

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}

app
    .use(ElementPlus)
    .use(router)
    .use(pinia)
    .mount('#app')